package org.rqb.panel.partPanel;

import javax.swing.*;
import java.awt.*;

public class RepeatNumPanel extends JPanel {

    private JLabel label; // 改用JLabel，更可靠

    public RepeatNumPanel(String repeatNum) {
        setLayout(new BorderLayout()); // 改用BorderLayout

        // 使用JLabel代替JTextField
        label = new JLabel(repeatNum, SwingConstants.CENTER);
        label.setFont(new Font("Arial", Font.BOLD, 18)); // 使用Arial字体，加大字号
        label.setForeground(Color.BLACK);
        label.setOpaque(true);
        label.setBackground(Color.WHITE);

        add(label, BorderLayout.CENTER);

        // 设置面板样式
        setOpaque(true);
        setBackground(new Color(255, 255, 255,48));

        // 确保大小
        setPreferredSize(new Dimension(120, 40));

    }

    public void setRepeatNum(String repeatNum) {
        label.setText(repeatNum);
        repaint();
    }
}

